﻿using System;
using System.Linq;
using System.Threading.Tasks;

namespace ElevatorDispatching
{
    /// <summary>
    /// 仅将信号发送给单部电梯的信号处理器
    /// </summary>
    public class SingleCageSignalHandler : SignalHandlerBase
    {
        public SingleCageSignalHandler(IFloorGroup floors, IElevatorGroup elevators) : base(floors, elevators)
        {
        }

        /// <summary>
        /// 处理呼梯信号，将呼梯信号直接转发给电梯组的第一部电梯
        /// </summary>
        /// <param name="signal"></param>
        /// <returns></returns>
        protected override bool HandleCallCageSignal(CallCageSignal signal)
        {
            Elevators.First().CallCage(signal);
            return true;
        }
    }
}
